<%--
  Created by IntelliJ IDEA.
  User: Aqqqwer
  Date: 2021/7/6
  Time: 18:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户登录页面</title>
    <script src="/js/jquery/jquery-3.3.1.js"></script>
</head>
<style>
   @import "/css/daohang.css";
   @import "/css/header.css";
</style>
<div class="header_bd">
    <!-- 头部 -->

    <div class="header" >
        <h1><img style="height: 50px;width: 180px"
                 src="">
        </h1>
        <form>
            <input type="text" name="search" placeholder="Search.." class="search">
        </form>
        <button class="searchButton searchButton2">立即搜索</button>
        <div class="login">
        </div>
    </div>
<div>
    <div class="topNav">
        <!-- 导航栏 -->
        <div style="float: left;">
            <button style="" class="links_button button dropdown">
                <a href="tuijian.jsp" style="text-decoration: none">推荐</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
            <button style="" class="links_button button dropdown">
                <a href="yingshi.jsp" style="text-decoration: none">影视</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
            <button style="" class="links_button button dropdown">
                <a href="yinyue.jsp" style="text-decoration: none">音乐</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
            <button style="" class="links_button button dropdown">
                <a href="youxi.jsp" style="text-decoration: none">游戏</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
            <button style="" class="links_button button dropdown">
                <a href="tiyu.jsp" style="text-decoration: none">体育</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
            <button style="" class="links_button button dropdown">
                <a href="zongyi.jsp" style="text-decoration: none">综艺</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
            <button style="" class="links_button button dropdown">
                <a href="yule.jsp" style="text-decoration: none">娱乐</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
            <button style="" class="links_button button dropdown">
                <a href="dongman.jsp" style="text-decoration: none">动漫</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
            <button style="" class="links_button button dropdown">
                <a href="shenghuo.jsp" style="text-decoration: none">生活</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
            <button style="" class="links_button button dropdown">
                <a href="meishi.jsp" style="text-decoration: none">美食</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
            <button style="" class="links_button button dropdown">
                <a href="chongwu.jsp" style="text-decoration: none">宠物</a>
                <span class="dropdown-content">
                    <a href="#">1</a>
                    <a href="#">2</a>
                    <a href="#">3</a>
                </span>
            </button>
        </div>
    </div>
</div>
</div>
<body>
<div style="width:100%;height:100%">
<form action="#" method="post">
    <div style="background-image: linear-gradient(to bottom right, white, aqua); border-radius: 25px;height:250px;width:300px;position: fixed;left: 600px;top:200px">
    <ul style="list-style: none;line-height: 28px">
        <li><h3 style="text-align:center;border-radius: 15px;letter-spacing:15px">会员用户登录</h3></li>
        <li><span>邮箱:<input style="border-radius: 15px;" type="email" name="email" placeholder="邮箱" required></span></li>
        <li><span>密码:<input style="border-radius: 15px;" type="password" name="password" placeholder="密码" required></span></li>
        <li>
            <p><span><button type="button" onclick="loginUsers()">立即登录</button>
                <button type="reset">重新填写</button></span></p>
                <p><span><button><a href="register_user.jsp">注册</a></button>
                    <button><a href="update_password_code.jsp">忘记密码？</a></button></span></p>
        </li>
    </ul>
        </div>
</form>
</div>
<script>
    function loginUsers(){
        var email=$(':input[type="email"]').val();
        var password=$(':password[name="password"]').val();
        $.ajax({
            url:"/user/login",
            type:"post",
            data:{email:email,password:password},
            datatype: 'json',
            success:function (data){
                if($.isEmptyObject(data)){
                    alert('登录失败，邮箱或密码错误');
                    window.location.reload();
                }else{
                    alert('登录成功');
                    window.location.href="user_center.jsp";
                }
            }
        });
    }
</script>
</body>
</html>
